from fastapi import FastAPI
import uvicorn
from src.Api.Index import setup_routes

# def initialize_services():
#     # # 初始化日志
#     # LogManager.configure_logging()
    
#     # 初始化服务
#     pet_qaservice = PetQAService()
#     product_service = ProductService()
#     recommendation_service = RecommendationService()
    
#     # 初始化核心模块
#     pet_assistant = PetAssistant(
#         pet_qaservice,
#         product_service,
#         recommendation_service
#     )
    
#     return pet_qaservice, product_service, recommendation_service, pet_assistant

def create_app():
    app = FastAPI(
        title="宠物助手 API",
        description="小瑞宠物助手 API 文档",
        version="1.0.0"
    )

    # print("router ============================")
    # 初始化服务
    # services = initialize_services()
    # API routes
    setup_routes(app)
    
    # print("app_controller ============================")
    return app



# Create app instance at module level
app = create_app()

if __name__ == "__main__":
    # 启动服务
    uvicorn.run(
        "main:app",
        host="0.0.0.0",
        port=8000,
        reload=True,
        log_level="info"
    )
